import sys
import logging
class MyException(Exception):
    def __init__(self, value, string):
        self.value = value
        self.str = string
def f():
    raise MyException(3, "hello")
def f1():
    result = f()

try:
    f()
except Exception, e:
    print e.str
    logging.info("%s", e.str)